perf(wa-sqlite): prioritize dedicated-worker reads during sync#167
Open
marcus-pousette wants to merge 1 commit into
Open
perf(wa-sqlite): prioritize dedicated-worker reads during sync#167marcus-pousette wants to merge 1 commit into
marcus-pousette wants to merge 1 commit into
Conversation
7a95c36 to
eee9e75
Compare
94c727d to
5e8e544
Compare
5e8e544 to
18736d0
Compare
18736d0 to
440acd5
Compare
Collaborator
Author
|
/bench |
Contributor
BenchmarksTriggered by
Status: ✅ <5% change | 🟡 5–10% | 🟠 10–30% | 🔴 >30% Artifacts:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Let foreground engine reads run between background inbound-sync batches in dedicated-worker wa-sqlite clients.
#166 creates an event-loop gap between remote apply batches. This PR adds the small priority scheduler that decides what may use that gap.
Ordering rules
appendManycalls are explicitly background.Direct and shared-worker runtimes keep their existing FIFO paths and pay no scheduler overhead. Public write options expose only
background;foregroundremains an internal read classification, so callers cannot make writes jump sync work.Why dedicated-worker only
The earlier revision also changed the shared worker's global queue, but its benchmark used one client/port and therefore did not exercise cross-tab scheduling. That unproven scope and its wire-protocol field are removed. A future shared-worker change should begin with a two-port ordering test and benchmark.
Performance evidence
Focused run 29203415286 completed four counterbalanced normal/background trials per case. Values are background-vs-normal deltas between trial medians; negative latency is better.
Every empty-tree trial improved read p95 (memory: 11.3–14.6%; OPFS: 14.4–17.9%). Populated cases stayed near neutral. The largest median latency cost was 4.0% remote-batch p95. Four trials are directional evidence, not a claim of statistical certainty.
The harness's total-duration field included the final integrity read, so this decision deliberately does not use its derived throughput values. Per-operation latency samples and the final-count integrity check are unaffected.
Debloat
Verification
git diff --checkpass.Dependency
Stacked on #166. Review only this incremental diff.